<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jq/jquery1.9/jquery-1.9.0.js"></script>
    <style>
        .ball{
            width:50px;
            height: 50px;
            background:hotpink;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div class="ball ball1"></div>   
    <div class="ball ball2"></div>   
    <div class="ball ball3"></div>   
    <div class="ball ball4"></div>   
    <div class="ball ball5"></div>   
    <br>
    <input type="button" value="move" onclick="doMove()">
    <script>
        function doMove(){
            //获取jQuery对象
            var ball1=$(".ball1");
            var ball2=$(".ball2");
            var ball3=$(".ball3");
            var ball4=$(".ball4");
            var ball5=$(".ball5");
            ball1.animate({
                "margin-left":"100px"
            },1000,function(){
                ball2.animate({
                    "margin-left":"200px"
                },1000,function(){
                    ball3.animate({
                        "margin-left":"300px"
                    },1000,function(){
                        ball4.animate({
                            "margin-left":"400px"
                        },1000,function(){
                            ball5.animate({
                                "margin-left":"500px"
                            },1000,function(){
                                ball5.animate({
                                    "margin-left":"0px"
                                },1000,function(){
                                    ball4.animate({
                                        "margin-left":"0px"
                                    },1000,function(){
                                        ball3.animate({
                                            "margin-left":"0px"
                                        },1000,function(){
                                            ball2.animate({
                                                "margin-left":"0px"
                                            },1000,function(){
                                                ball1.animate({
                                                    "margin-left":"0px"
                                                },1000);
                                            });
                                        });
                                    });
                                });
                            });
                        });
                    });
                });
            });



        }
    </script>
</body>
</html>